package net.com.parkingos.filter;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author ASUS
 * @date 2020/4/7
 */
@WebFilter()
public class FilterServlet extends HttpFilter {
    @Override
    protected void doFilter(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws IOException, ServletException {

        //设置编码
        res.setContentType("text/html;charset=utf-8");
        req.setCharacterEncoding("utf-8");

        chain.doFilter(req,res);
    }
}
